home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 December / PCWDEC06.iso / Software / Trial / Paint Shop Pro XI / Data1.cab / _FEB4CAE4A8174DEAA7D78BB3945CB694 < prev    next >
Encoding:
Text File  |  2006-08-04  |  1.9 KB  |  46 lines

  1. from PSPApp import *
  2. import PSPUtils
  3. import os.path
  4.  
  5. def ScriptProperties():
  6.     return {
  7.         'Author': u'Corel Corporation',
  8.         'Copyright': u'Copyright (c) 2002-2006 Corel Corporation. All rights reserved.',
  9.         'Description': "Create a palette from the open image.  The user is prompted for the number of colors to use.",
  10.         'Host': u'Paint Shop Pro',
  11.         'Host Version': u'8.00'
  12.         }
  13.  
  14. def Do(Environment):
  15.     if PSPUtils.RequireADoc( Environment ) == App.Constants.Boolean.false:
  16.         return
  17.     
  18.     # bring up the decrease colors to X dialog and let the user choose how many colors they want
  19.     App.Do( Environment, 'DecreaseColorsToX', {
  20.             'Boost': App.Constants.Boolean.false, 
  21.             'BoostAmount': 1, 
  22.             'Colors': 256, 
  23.             'IncludeWindowsColors': App.Constants.Boolean.false, 
  24.             'ReductionMethod': 0, 
  25.             'PaletteMethod': 0, 
  26.             'ReduceBleeding': App.Constants.Boolean.false, 
  27.             'GeneralSettings': {
  28.                 'ExecutionMode': App.Constants.ExecutionMode.Interactive, 
  29.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  30.                 }
  31.             })
  32.  
  33.     # save the palette - set the palette name to match the name of the current document
  34.     # don't specify a directory so that it goes to the last used dir
  35.     
  36.     # change the extension to .psppalette - truncate the file name at the last
  37.     # period and slap on a .PspPalette extension
  38.     PaletteFileName, OldExt = os.path.splitext( App.TargetDocument.Title )
  39.     App.Do( Environment, 'SavePalette', {
  40.             'SavePaletteFileName': PaletteFileName, 
  41.             'GeneralSettings': {
  42.                 'ExecutionMode': App.Constants.ExecutionMode.Interactive, 
  43.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  44.                 }
  45.             })
  46.